package cn.edu.zzti.base.dao.jdbc;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import cn.edu.zzti.base.dao.GenericDao;
import cn.edu.zzti.base.dao.SearchException;
import cn.edu.zzti.base.model.BaseEntityModel;

@Repository
public class GenericDaoJdbc<T extends BaseEntityModel, PK extends Serializable>
		implements GenericDao<T, PK> {

	private Class<T> persistentClass;

	T model;

	@Autowired
	JdbcTemplate jdbcTemplate;

	String sql;

	@Override
	public List<T> getAll() {
		this.sql = "SELECT * FROM " + this.persistentClass.getName();
		List<T> result = this.jdbcTemplate.queryForList(sql,
				this.persistentClass);
		return result;
	}

	@Override
	public List<T> getAllDistinct() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<T> search(String searchTerm) throws SearchException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public T get(PK id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean exists(PK id) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public T save(T object) {
		return null;
	}

	@Override
	public void remove(T object) {
		// TODO Auto-generated method stub

	}

	@Override
	public void remove(PK id) {
		// TODO Auto-generated method stub

	}

	@Override
	public void reindex() {
		// TODO Auto-generated method stub

	}

	@Override
	public void reindexAll(boolean async) {
		// TODO Auto-generated method stub

	}

}
